1. Field of the Invention
The invention relates to computers and, more specifically, to the processing of pixel data values.
2. Description of Related Art
Images displayed on computer monitors are generated by joining many miniature picture elements commonly referred to as pixels. The pixels are represented in a variety of formats. The most common pixel formats are 8-bit, 16-bit, and 24-bit.
The format used varies based upon such factors as the monitor, the graphics card, and the amount of memory intended to be used. Some of the formats are based on a combination of red, green, and blue values. For example, a twenty-four-bit pixel format is typically composed of eight bits of red data, eight bits of green data, and eight bits of blue data. The format is commonly referred to as an 8/8/8 format following Red/Green/Blue, and is a common pixel format used for storing the pixel bits in a memory array.
Not all color pixel formats, however, are based on some combination of the colors red, green, and blue. The 8-bit format is often referred to as a Color Look Up Table (CLUT index). In this case, each 8-bit pixel is an index into an array of 256 arbitrary colors. However, in the remainder of the present application, in order not to obscure the present invention, it will be assumed that pixels are provided as red, green, and blue bits.
Twenty-four-bit pixel colors are considered to be very expensive for storage and generating images on a color monitor. As a result, there continues to be an abundance of video displays that require 16-bit pixels. As such, when an image represented by twenty-four-bit pixels is input into a computer system (e.g., scanned), it is typically compressed into sixteen-bit pixel formats before it is stored or can be generated as an image to be displayed on a monitor.
Moreover, some colored pixels are generated from a graphics pipeline, which involves a real time processing procedure for transforming a three-dimensional image into a two-dimensional image to be displayed on a computer monitor. In the pipeline, 48-bit pixels are generated, wherein 16-bits represent each red, green, and blue color. As such, pixels generated from the graphics pipeline need to be compressed from 48-bit pixels to 16-bit pixels.
The graphics pipeline is usually composed of two main pieces, a "geometry engine" and a "renderer". The purpose of the geometry engine is to build a three-dimensional image from its base parts. The purpose of the renderer is to take the created three-dimensional image and convert it to a two-dimensional image to be displayed on a monitor. More specifically, the geometry engine starts with a list of vertices and edges, connects the vertices and generates polygons (e.g., squares, triangles, hexagons) representing the three-dimensional image.
Once the three-dimensional image is generated, it is passed to the renderer. As stated, the renderer is responsible for generating a two-dimensional version of the three-dimensional image, so as to be displayed on a monitor. One process of the renderer is referred to as "culling", which involves eliminating the areas of a three dimensional image that would not be visible in a two-dimensional image. For example, consider the image of a building as seen from across a street, everything behind the face of the building would be eliminated because it would not be visible in a two-dimensional image.
In the next stage of the graphics pipeline, the renderer begins to generate the colors of an image. Some parts of an image may consist of a solid color and require the relatively simple process of generating the solid color. For example, the color of a clear flat blue sky would involve the simple process of generating the single flat blue color of the sky.
Other areas of an image, however, may involve complex processing. For example, the color of a window in the building would be determined by considering the amount of light on each side of the window, the angle of the view presenting the window, any image viewed on the inside of the window, and any possible reflection off the window. Moreover, it is possible to generate an area of the window so that, simultaneously, an item can be seen behind the window, and a reflection can appear on the outside of the window.
Calculating the color of such an image requires a high degree of precision and takes a much different path than the "flat shaded" blue sky. As a result, 16-bits are used to represent each red, green, and blue color of a pixel in the graphics pipeline, thereby presenting a 48-bit pixel when generating a complex color for an image. However, as previously explained, the pixels need to be compressed into 16-bit pixels for efficient storage and to be displayed on monitors.
Moreover, the fact that the graphics pipeline is an on-line real time process means that it is very performance-sensitive. Any slowdown in the pipeline process would result in slower video playback, less stunning graphics in video games, or some other related detraction from the visual experience.
Typically, in order to compress the 48-bit pixels into 16-bit pixels, each red, green, or blue color would be loaded into separate 32-bit registers. Multiple shift, copy, load, and logical OR instructions would be executed to individually compress the separate colors and join the compressed colors into one register to represent one 16-bit pixel.
Advancements in computer architecture, however, provide an ability to process small integer data values more efficiently. More specifically, the advancements include the ability to process multiple small integer data values in parallel in response to a single instruction, otherwise referred to as a Single Instruction Multiple Data, hereinafter referred to as an SIMD. The multiple data elements are joined together as packed data sequences. The packed data sequences provide a single data structure storing of up to sixty-four-bits of integer data in one register, wherein the sequence includes multiple data elements of equal size.
Therefore, what is needed is an accelerated method for accepting 48-bit pixels generated by a graphics pipeline and compressing the pixels to 16-bit pixels, by using 64-bit packed data sequences and related SIMD instructions, so as to enhance the visual experience of displaying an image generated by a graphics pipeline.